@extends('backend::modal')
@section('title',$page_title??'重置密码')
@section('content')
    <div class="row">
        <!--/.col-->
        <div class="col-sm-12">
            @component('backend::component.tab')
                @slot('tabs')
                    <li class="nav-item">
                        <a class="nav-link active" data-toggle="tab" href="#tab-login-pwd" role="tab">重置登录密码</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" data-toggle="tab" href="#tab-safe-pwd" role="tab">重置安全密码</a>
                    </li>
                @endslot
                    <div class="tab-pane active" id="tab-login-pwd" role="tabpanel">
                        @component('backend::admin.pwd_form.reset_pwd_form')
                            @slot('title') 登录密码 @endslot
                            @slot('id') reset-login-pwd @endslot
                            @slot('action') {{route('b_Admin_reset',['admin_name'=>$admin_name,'action'=>'login'])}} @endslot
                            @slot('pwd_name') login_pwd @endslot
                        @endcomponent
                    </div>
                    <div class="tab-pane" id="tab-safe-pwd" role="tabpanel">
                        @component('backend::admin.pwd_form.reset_pwd_form')
                            @slot('title') 安全密码 @endslot
                            @slot('id') reset-safe-pwd @endslot
                            @slot('action') {{route('b_Admin_reset',['admin_name'=>$admin_name,'action'=>'safe'])}} @endslot
                            @slot('pwd_name') safe_pwd @endslot
                        @endcomponent
                    </div>
            @endcomponent
        </div>
    </div>
@endsection
@push('scripts')
    <script type="text/javascript">
        layui.use(['jquery'],function () {
            var $ = layui.jquery;
            $('.set-pwd-btn').each(function () {
                $(this).off('click').on('click',function () {
                    setPwd(this);
                })
            })
            function setPwd(obj) {
                var params = $(obj).data('params');
                var pwd = randPassword();
                $('input[name="'+params.targetIpt+'"]').val(pwd);
                $('input[name="confirm_'+params.targetIpt+'"]').val(pwd);
            }
        })
    </script>
@endpush